Skip to content

Extend Native AOT support for PKI management APIs#1

Merged
bbartels merged 2 commits into
masterfrom
copilot/fix-native-aot-support
Jul 4, 2026
Merged

Extend Native AOT support for PKI management APIs#1
bbartels merged 2 commits into
masterfrom
copilot/fix-native-aot-support

Conversation

Copilot AI commented Jul 4, 2026

Copy link
Copy Markdown

The upstream PKI management commit (rajanadar/VaultSharp@8cb298c) added Issuers/Keys/Roles APIs whose types were not covered by the existing Native AOT source-generation context, and whose enum converters used the reflection-based non-generic JsonStringEnumConverter.

Enum converters

Four new PKI enums updated to use the AOT-safe generic form under NET8_0_OR_GREATER, preserving the non-generic fallback for older TFMs — matching the pattern already established in the PR for CertificateFormat, PrivateKeyFormat, etc.:

#if NET8_0_OR_GREATER
    [JsonConverter(typeof(JsonStringEnumConverter<IssuerFormat>))]
#else
    [JsonConverter(typeof(JsonStringEnumConverter))]
#endif
public enum IssuerFormat { ... }

Affected: IssuerFormat, IssuerPrivateKeyFormat, PrivateKeyType, PrivateKeyRoleType.

VaultSharpJsonContext registrations

Added [JsonSerializable] entries for all new PKI request/response types:

  • Issuers: Secret<IssuerResponseData>, Secret<IssuerConfigResponseData>, Secret<IssuerData>, Secret<KeysData>, plus bare DTO types IssuerData, IssuerConfigRequestData, IssuerConfigResponseData, IssuerResponseData
  • Keys: Secret<KeysData>, Secret<KeyData>, Secret<ImportKeyData>, plus bare KeyData, ImportKeyData
  • Roles: Secret<RolesData>, Secret<RoleData>, plus bare RoleData, RolesData
  • Supporting: Dictionary<string, KeyInfo> variants for both namespaces

KeysData and KeyInfo each exist in both Issuers and Keys namespaces; all four are disambiguated with TypeInfoPropertyName to avoid source-gen naming conflicts.

File rename

IssuerPrivetKeyFormat.csIssuerPrivateKeyFormat.cs (typo; type name IssuerPrivateKeyFormat was already correct).

- Fix enum JsonConverter attributes to use generic JsonStringEnumConverter<T>
  under NET8_0_OR_GREATER for AOT safety (IssuerFormat, IssuerPrivateKeyFormat,
  PrivateKeyType, PrivateKeyRoleType), with non-generic fallback for older TFMs
- Rename IssuerPrivetKeyFormat.cs -> IssuerPrivateKeyFormat.cs (typo fix)
- Add JsonSerializable registrations in VaultSharpJsonContext for all new PKI
  Issuers/Keys/Roles request and response types; use TypeInfoPropertyName to
  disambiguate KeysData and KeyInfo which exist in both Issuers and Keys namespaces
Copilot AI changed the title [WIP] Amend Native AOT support for .NET 8+ Extend Native AOT support for PKI management APIs Jul 4, 2026
Copilot AI requested a review from bbartels July 4, 2026 14:50
@bbartels
bbartels marked this pull request as ready for review July 4, 2026 14:52
@bbartels
bbartels merged commit 30dcf9b into master Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants